<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>反转字符串</title>
</head>
<body>
    <script>

            var str = 'abcdefg';

            /* 思路：先转数组调用反转方法，再转化字符串 */

            // 转数组->反转->转字符串
            var newStr = str.split('').reverse().join('');
            console.log('原字符串为：',str)
            console.log('新字符串为：',newStr);

    </script>
</body>
</html>